package org.smart4j.framework.util;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;

import java.util.Collection;
import java.util.Map;

/**
 * Created by Administrator on 2016/12/10.
 * Description: 集合工具类
 */
public final class CollectionUtil {

    /**
     * author: Wangminze
     * date: 2016/12/10
     * description: 判断是否为空
     * @param collection 任何一种集合类型
     * @return
     */
    public static boolean isEmpty(Collection<?> collection){
        return CollectionUtils.isEmpty(collection);
    }

    /**
     * author: Wangminze
     * date: 2016/12/10
     * description: 判断是否为空
     * @param collection 任何一种集合类型
     * @return
     */
    public static boolean isNotEmpty(Collection<?> collection) {
        return !CollectionUtils.isEmpty(collection);
    }

    /**
     * author: Wangminze
     * date: 2016/12/10
     * description: 判断Map是否为空
     * @param map
     * @return
     */
    public static boolean isEmpty(Map<?,?> map){
        return MapUtils.isEmpty(map);
    }

    /**
     * author: Wangminze
     * date: 2016/12/10
     * description: 判断Map是否非空
     * @param map
     * @return
     */
    public static boolean isNotEmpty(Map<?,?> map){
        return !isEmpty(map);
    }
}
